import $api from "@/http/api";

export default {
    namespaced: true,
    state: {
        rows: [],
        // total: 0,
        // pages: 0,
    },
    mutations: {
        SET_DATA(state, payload) {
            // console.log(payload);
            state.rows = payload;
        },
    },
    actions: {
        // 获取所有套餐
        async getDataAsync(context, pages) {
            const { data } = await $api.Meal.mealGet();
            if (data.meta.status == 200) {
                context.commit("SET_DATA", data.data);
            }
        },
        // 删除套餐
        async deleteOnceData(context, _id) {
            const { data } = await $api.Meal.mealDel(_id);
            console.log(data);
            return data;
        },
    },
};